using IcsSEMCtrl.Util;
namespace Lifter.Global.Device
{
    public class AlarmState
    {
        public const int _SC_ALARMSET = 0;
        public const int _SC_ALARMCLEAR = 1;
        private int _value;
        private static int _size;
        private static AlarmState[] _array;
        public static string[] displayStrings;
        public static AlarmState[] displayValues;
        public static AlarmState SC_ALARMSET;
        public static AlarmState SC_ALARMCLEAR;
        public static AlarmState IT_ENUM_MAX;
        static AlarmState()
        {
            AlarmState._size = 2;
            AlarmState._array = new AlarmState[AlarmState._size];
            AlarmState.displayStrings = new string[AlarmState._size];
            AlarmState.displayValues = new AlarmState[AlarmState._size];
            AlarmState.SC_ALARMSET = new AlarmState(0);
            AlarmState.SC_ALARMCLEAR = new AlarmState(1);
            AlarmState.IT_ENUM_MAX = new AlarmState(2147483647);
            AlarmState.displayStrings[0] = "SC_ALARMSET";
            AlarmState.displayStrings[1] = "SC_ALARMCLEAR";
            AlarmState.displayValues[0] = AlarmState.SC_ALARMSET;
            AlarmState.displayValues[1] = AlarmState.SC_ALARMCLEAR;
        }
        public static string ValueToString(AlarmState val)
        {
            string result;
            switch (val.Value())
            {
                case 0:
                    result = AlarmState.displayStrings[0];
                    break;
                case 1:
                    result = AlarmState.displayStrings[1];
                    break;
                default:
                    result = "";
                    break;
            }
            return result;
        }
        public static AlarmState StringToValue(string val)
        {
            AlarmState result;
            if (Helper.IsNullOrEmpty(val))
            {
                result = AlarmState.IT_ENUM_MAX;
            }
            else
            {
                for (int i = 0; i < AlarmState.displayStrings.Length; i++)
                {
                    if (val.Equals(AlarmState.displayStrings[i]))
                    {
                        result = AlarmState.displayValues[i];
                        return result;
                    }
                }
                result = null;
            }
            return result;
        }
        public int Value()
        {
            return this._value;
        }
        public static AlarmState From_Int(int value)
        {
            AlarmState result;
            if (value >= 0 && value < AlarmState._size)
            {
                result = AlarmState._array[value];
            }
            else
            {
                result = AlarmState.IT_ENUM_MAX;
            }
            return result;
        }
        protected AlarmState(int value)
        {
            this._value = value;
            if (value >= 0 && value < AlarmState._size)
            {
                AlarmState._array[this._value] = this;
            }
        }
        public bool Equals(AlarmState otherEnum)
        {
            return otherEnum.Value() == this._value;
        }
        public override string ToString()
        {
            return AlarmState.displayStrings[this._value];
        }
    }
}
